package com.zjut.azhen.DBDesign.mapping;

import com.zjut.azhen.DBDesign.bean.Students;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author asus
 */
@Repository
public interface StudentsMapper {
    @Select("select * from zhengjy_students")
     List<Students> getAll();

    @Update("update zhengjy_students set sname=#{sname} ,ssex=#{ssex},sRegion=#{sRegion},sCredit=#{sCredit} where sno=#{sno}")
    Integer updateStu(Students students);

    @Insert("insert into zhengjy_students values(#{sno},#{sname},#{sCredit},#{ssex},#{sRegion},#{clno},#{mno});")
    Integer insertStu(Students students);

    //TODO:delete trigger needed


    @Delete("delete from zhengjy_students where sno=#{id}")
    Integer deleteStuByid(String id);

    @Select("select * from zhengjy_students where sno=#{id}")
    Students getStuById(String id);


}
